package com.xjy.controller;

import com.xjy.model.auto.ProjectInfo;
import com.xjy.service.IProjectInfoService;
import com.xjy.service.IRecruitmentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 项目信息表 前端控制器
 * </p>
 *
 * @author 达瓦里氏
 * @since 2021-11-10
 */
@RestController
@RequestMapping("/project-info")
@CrossOrigin
public class ProjectInfoController {

    @Autowired
    private IProjectInfoService projectInfoService;

    /*查询用户*/
    @GetMapping("/getProject")
    public List<ProjectInfo> getProjectInfo(){
        return projectInfoService.list();
    }

    /*通过id查询用户*/
    @GetMapping("/getProjectById/{id}")
    public ProjectInfo getProjectInfoById(@PathVariable("id") int id){
        return projectInfoService.getById(id);
    }

    /*修改用户*/
    @PostMapping("/updateProject")
    public void updateProjectInfo(@RequestBody ProjectInfo projectInfo){
        projectInfoService.updateById(projectInfo);
    }

    /*添加用户*/
    @PostMapping("/setProject")
    public void setProjectInfo(@RequestBody ProjectInfo projectInfo){
        projectInfoService.save(projectInfo);
    }

    /*删除用户*/
    @PostMapping("/deletedById/{id}")
    public boolean deleted(@PathVariable("id") int id){
        return projectInfoService.removeById(id);
    }
}


